using System.Collections.Generic;
using Wolfpack.Core;
using Wolfpack.Core.Configuration;
using Wolfpack.Core.Interfaces.Entities;
using Wolfpack.Core.Notification.Filters.Request;

namespace Wolfpack.Contrib.Checks.Ssl
{
    public class SslCertificateExpiryConfigurationDiscovery : HealthCheckDiscoveryBase<SslCertificateExpiryCheckConfig, SslCertificateExpiryCheck>
    {
        protected override SslCertificateExpiryCheckConfig GetConfiguration()
        {
            return new SslCertificateExpiryCheckConfig
                       {
                           Enabled = true,
                           FriendlyId = "SslCertificateExpiry",
                           Hostnames = new List<string> {"appharbor.com"},
                           NotificationMode = StateChangeNagFailNotificationFilter.FilterName,
                           NotificationThreshold = 21   // days
                       };
        }

        protected override void Configure(ConfigurationEntry entry)
        {
            entry.Name = "SslCertificateExpiry";
            entry.Description = "This check will check the SSL certificate for a domain and if it expires " +
                                "within the number of days set in the NotificationThreshold it will generate an alert.";
            entry.Tags.AddIfMissing("SSL", "Certificate");
        }
    }
}